package com.yumei.trader.gym.raw;

import android.content.Context;

import com.yumei.trader.gym.R;


public class GameSoundManager {

	private static GameSoundManager instance;

	private TradeSoundPool soundPools;
	
	private boolean openMusic = true;
	private boolean openSound = true;
	
	public GameSoundManager(){
	   
	}

	public static GameSoundManager getInstance(){
		if(instance == null){
			instance = new GameSoundManager();
		}
		return instance;
	}
	
	public void setOpenMusic(boolean open){
		this.openMusic = open;
	}
	
	public void setOpenSound(boolean open){
		this.openSound = open;
		
		TradeSoundPool.status = open;
	}

	public TradeSoundPool getSoundPool(Context context){

		if(soundPools == null){
			soundPools = new TradeSoundPool(context);

			soundPools.loadSound(context, TradeSoundPool.ACTION_BUTTON, R.raw.button);
			soundPools.loadSound(context, TradeSoundPool.ACTION_BUY, R.raw.game_buy);
			soundPools.loadSound(context, TradeSoundPool.ACTION_SELL, R.raw.game_sell);

			soundPools.loadSound(context, TradeSoundPool.GAMEOVER_WIN, R.raw.gameover_gain);
			soundPools.loadSound(context, TradeSoundPool.GAMEOVER_FAIL, R.raw.gameover_loss);
			soundPools.loadSound(context, TradeSoundPool.GAMEOVER_RESULT, R.raw.gameover_result);
		}
		
		soundPools.setStatus(openSound);
		
		return soundPools;
	}
}


